<?php 
class Sosweb_Logger
{
    private $fileLogger;
    private $firebugLogger;
    private $filePath;
    
    public function __construct($logPath)
    {
        $this->filePath = $logPath;
        //setup firebug logger
        $this->firebugWriter = new Zend_Log_Writer_Firebug();
        $this->firebugLogger = new Zend_Log($this->firebugWriter);
          
        if($this->filePath != null)
        {
            $this->fileWriter = new Zend_Log_Writer_Stream($logPath);
            $this->fileLogger = new Zend_Log($this->fileWriter);
        }
    }
    
    public function info($message)
    {
        if($this->filePath != null)
            $this->fileLogger->log($message, Zend_Log::INFO);
        
        $this->firebugLogger->log($message, Zend_Log::INFO);
    }
    
    public function warn($message)
    {
        if($this->filePath !== null)
            $this->fileLogger->log($message, Zend_Log::WARN);
        
        $this->firebugLogger->log($message, Zend_Log::WARN);
    }

    public function error($message)
    {
        if($this->filePath !== null)
            $this->fileLogger->log($message, Zend_Log::ERR);
        
        $this->firebugLogger->log($message, Zend_Log::ERR);
    }    
}